﻿using RAP.Framework.Libary.DataSource.Context;
using RAP.Framework.Libary.Utils;
using RAP.Web.Libary.Common.Model.Session;

namespace RAP.Web.Libary.Common.Model
{
  /// <summary>
  /// 查询参数对象
  /// </summary>
  public abstract class APIQueryParams : AbstractQueryParam, IAPIQueryParams
  {
    /// <summary>
    /// 
    /// </summary>
    public APIQueryParams()
    {
      AutoCreateProperty = false;
    }

    /// <summary>
    /// 获取Token
    /// </summary>
    [DynamicProperty("token")]
    public virtual string Token { get; set; }

    /// <summary>
    /// 获取城市编码
    /// </summary>
    public virtual string CityCode { get; set; }

    /// <summary>
    /// 获取用户Id
    /// </summary>
    public virtual int UserId
    {
      get => this.UserSession?.UserInfo?.UserId ?? 0;
    }

    /// <summary>
    /// 是否显示流水日志
    /// </summary>
    public virtual bool ShowLogs { get; set; }

    /// <summary>
    /// 获取用户回话
    /// </summary>
    public virtual IUserSession UserSession { get; set; }
  }
}
